package cn.gailvlun.gll.net.emotion;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;



public class EmotionTagReq implements Parcelable {
    private int id;
    private String title;
    private String icon;
    @SerializedName("emotion_type")
    private String emotionState;
    @Expose(serialize = false, deserialize = false)
    private boolean isUserCreated;

    public String getTitle() {
        return title;
    }

    public EmotionTagReq setTitle(String title) {
        this.title = title;
        return this;
    }

    public String getIcon() {
        return icon;
    }

    public EmotionTagReq setIcon(String icon) {
        this.icon = icon;
        return this;
    }

    public EmotionEnum getEmotionState() {
        for (EmotionEnum state : EmotionEnum.values()) {
            if (state.name().equals(emotionState)) {
                return EmotionEnum.valueOf(emotionState);
            }

        }
        return null;
    }

    public EmotionTagReq setEmotionState(EmotionEnum emotionState) {
        if (emotionState != null) {
            this.emotionState = emotionState.name();
        }
        return this;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public boolean isUserCreated() {
        return isUserCreated;
    }

    public void setUserCreated(boolean userCreated) {
        isUserCreated = userCreated;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.id);
        dest.writeString(this.title);
        dest.writeString(this.icon);
        dest.writeString(this.emotionState);
        dest.writeByte(this.isUserCreated ? (byte) 1 : (byte) 0);
    }

    public EmotionTagReq() {
    }

    protected EmotionTagReq(Parcel in) {
        this.id = in.readInt();
        this.title = in.readString();
        this.icon = in.readString();
        this.emotionState = in.readString();
        this.isUserCreated = in.readByte() != 0;
    }

    public static final Creator<EmotionTagReq> CREATOR = new Creator<EmotionTagReq>() {
        @Override
        public EmotionTagReq createFromParcel(Parcel source) {
            return new EmotionTagReq(source);
        }

        @Override
        public EmotionTagReq[] newArray(int size) {
            return new EmotionTagReq[size];
        }
    };

    @Override
    public String toString() {
        return "EmotionTagReq{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", icon='" + icon + '\'' +
                ", emotionState='" + emotionState + '\'' +
                ", isUserCreated=" + isUserCreated +
                '}';
    }
}
